/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yunhoo.report.bean;

import com.yunhoo.report.model.ReportModel;
import com.yunhoo.sys.db.util.IbatisTemplate;
import com.yunhoo.sys.util.common.JsonBuilder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DeptBudgetReport1 implements Report {

    @Override
    public ReportModel buildReport(Map param) {
        System.out.println("build deptBudgetReport !");
        ReportModel reportModel = new ReportModel();
        reportModel.setReportHeader(buildReportHeader());
        reportModel.setJsonData(buildReportBody(param));
        return reportModel;
    }

    private Object[] buildReportHeader() {
        Object[] objArr;
        ReportHeaderGetter rhd = new ReportHeaderGetter();
        objArr = rhd.getReportHeader("sysconfig/reportHeader/deptBudget_report1.properties");
        return objArr;
    }

    private String buildReportBody(Map param) {
        Map map = new HashMap();
        map.put("orgCode", "10201");
        map.put("iyear", 2012);
        map.put("imonth", 12);;
        map.put("deptcode", "01");
        List<HashMap> datali = IbatisTemplate.queryForList("deptBudgetStats.queryListDeptBudgetReport1", map);
        return JsonBuilder.getJson(datali);
    }
}
